package com.api.syh56.shengyunhui.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.DefaultValue;
import lombok.*;
import lombok.experimental.FieldDefaults;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
@TableName("coupon_new")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CouponDet {
    @Column(name = "id")
    Long id;

    /**
     * 优惠券编码
     */
    @Column(name = "coupon_code",comment = "优惠券编码")
    Short couponCode;

    /**
     * 优惠券类型
     */
    @Column(name = "coupon_type",comment = "优惠券类型")
    Short couponType;

    /**
     * 折扣金额
     */
    @Column(name = "sum",comment = "折扣金额")
    BigDecimal sum;

    /**
     * 优惠券最低消费金额
     */
    @Column(name = "min_purchase",comment = "优惠券最低消费金额")
    BigDecimal minPurchase;

    /**
     * 优惠券开始时间
     */
    @Column(name = "start_date",comment = "开始时间")
    LocalDateTime startDate;

    /**
     * 截止日期结束时间
     */
    @Column(name = "end_date",comment = "截止日期")
    LocalDateTime endDate;

//    /**
//     * 优惠券总数量
//     * 10 (40张)
//     * 20 (30张)
//     * 50 (20张)
//     * 100 (10张)
//     * 200 (5张)
//     * 500 (2张)
//     */
//    Integer totalCoupon;
//    /**
//     * 剩余优惠券数量
//     */
//    Integer remainingCoupon;

    /**
     * 优惠券状态  0 已过期 1 有效  2 已使用
     */
    @Column(name = "coupon_status",comment = "优惠券状态")
    Short couponStatus;

    @Column(name = "use_time",comment = "使用时间")
    LocalDateTime useTime;

    @Column(name = "uid")
    Long uid;

    @Column(name = "wid")
    Long wid;

    @Column(name = "creation_time")
    @TableField(fill = FieldFill.INSERT)
    LocalDateTime creationTime;

    @Column(name = "last_modification_time")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    LocalDateTime lastModificationTime;

    @TableLogic
    @Column(name = "is_deleted")
    @DefaultValue("false")
    Boolean isDeleted;

    @Column(name = "eid",comment = "设备号")
    String eid;

    @Column(name = "cou_lock",comment = "加锁")
    @DefaultValue("0")
    Short couLock;
}
